<?php
class User extends BaseModel
{
    
    public $table = 'user';

    public function  userPasswdEncrypt($passwd,$num)
	{
		 $md51 = md5($passwd);
		 $md52 = md5($num);
		 $result = substr($md52,24,8);
		 $result .= substr($md51,0,24);
		 return md5($result);;
	}

    public function getUser($input)
	{
		$strSql="";
		if(isset($input["id"]))
		{
			$strSql = "SELECT * FROM user WHERE id=" . intval($input["id"]) . " AND is_del = 0";
		}
		elseif(isset($input["username"]))
		{
			$strSql = "SELECT * FROM user WHERE username=" . $input["username"] . " AND is_del = 0";
		}
		elseif(isset($input['weibo_id']))
		{
			$strSql = "SELECT * FROM user WHERE weibo_id=" . $input["weibo_id"] . " AND is_del = 0";
		}
		$result=$this->db()->query($strSql);
		return $result[0];
	}
    
}

/*
username
password
is_admin
is_del
*/